Skip to content

gh-132558: add convert_choices parameter to add_argument#133826

Closed
hansthen wants to merge 9 commits into
python:mainfrom
hansthen:issue-132558-add-convert-to-action
Closed

gh-132558: add convert_choices parameter to add_argument#133826
hansthen wants to merge 9 commits into
python:mainfrom
hansthen:issue-132558-add-convert-to-action

Conversation

@hansthen

@hansthen hansthen commented May 10, 2025

Copy link
Copy Markdown
Contributor

Add an optional argument to convert_choices to the add_argument function. This allows users to specify both a type and choices and will ensure the choices are converted by the type callable before checking. This improves usage, help and error messages for the end-user.


📚 Documentation preview 📚: https://cpython-previews--133826.org.readthedocs.build/

@hansthen hansthen force-pushed the issue-132558-add-convert-to-action branch from 7fb5415 to afaa8ab Compare May 10, 2025 14:05
@hansthen hansthen force-pushed the issue-132558-add-convert-to-action branch from afaa8ab to b1be432 Compare May 10, 2025 14:08
@hansthen hansthen marked this pull request as ready for review May 10, 2025 16:33
@savannahostrowski

Copy link
Copy Markdown
Member

As I mentioned before, I don't think we should do this. I think we should aim improve the documentation since this will scale better. I will review that PR next.

@hansthen hansthen closed this May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants